home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / jmtl028c.zip / DIALRESP.C next >
C/C++ Source or Header  |  1993-11-01  |  2KB  |  54 lines

  1. /*
  2.  * This sucker takes the result of a dial command, checks it to see if there
  3.  * was a session or not, and will keep track of the systems it couldn't
  4.  * connect to so the scheduler will dial them less often.
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include <dos.h>
  9. #include <stdlib.h>
  10. #include <dos/var.h>
  11. #include <string.h>
  12. #include <proto/dos.h>
  13.  
  14. extern struct DosLibrary *DOSBase;
  15.  
  16. void dialresp(char *address, char *response)
  17. {
  18.    int busy, maid;
  19.    char temp[255], var[60];
  20.  
  21.    UnLock(CreateDir("Env:JamTool"));
  22.  
  23.    if (!strcmp(response, "CONNECT"))
  24.    {
  25.       sprintf(var, "env:JamTool/Bad.%s", address);
  26.       remove(var);
  27.       sprintf(var, "env:JamTool/Busy.%s", address);
  28.       remove(var);
  29.       sprintf(var, "env:JamTool/Togo.%s", address);
  30.       remove(var);
  31.    }
  32.    else if (!strcmp(response, "BUSY"))
  33.    {
  34.       sprintf(var, "JamTool/Busy.%s", address);
  35.       if (GetVar(var, temp, 10, GVF_GLOBAL_ONLY) > 0) busy=atoi(temp);
  36.       sprintf(temp, "%d", busy+1);
  37.       SetVar(var, temp, -1, GVF_GLOBAL_ONLY);
  38.    }
  39.    else if (!strcmp(response, "MAID"))
  40.    {
  41.       sprintf(var, "JamTool/Bad.%s", address);
  42.       if (GetVar(var, temp, 10, GVF_GLOBAL_ONLY) > 0) maid=atoi(temp);
  43.       sprintf(temp, "%d", maid+1);
  44.       SetVar(var, temp, -1, GVF_GLOBAL_ONLY);
  45.    }
  46.    else if (!strcmp(response, "TIMEOUT"))
  47.    {
  48.       sprintf(var, "JamTool/Bad.%s", address);
  49.       if (GetVar(var, temp, 10, GVF_GLOBAL_ONLY) > 0) maid=atoi(temp);
  50.       sprintf(temp, "%d", maid+1);
  51.       SetVar(var, temp, -1, GVF_GLOBAL_ONLY);
  52.    }
  53. }
  54.